Conversation
| from .py_diag_manager.pyfms_diag_manager import pyFMS_diag_manager | ||
| from .py_field_manager.py_field_manager import FieldTable | ||
| from .py_horiz_interp.py_horiz_interp import HorizInterp | ||
| from .py_horiz_interp.py_horiz_interp import pyFMS_horiz_interp |
There was a problem hiding this comment.
I changed it to match the names of the other modules. If desired it can be changed back.
There was a problem hiding this comment.
let's change it back, the other modules need to be changed
| self, | ||
| diag_model_subset: int = None, | ||
| time_init: NDArray = None, | ||
| err_msg: str = None, |
There was a problem hiding this comment.
err_msg is an out, it doesn't need to be a function argument
| def diag_send_complete( | ||
| self, | ||
| diag_field_id: int, | ||
| err_msg: str = None, |
| _cfms_diag_send_complete(diag_field_id_c, err_msg_c) | ||
|
|
||
| if err_msg is not None: | ||
| return err_msg_c.value.decode("utf-8") |
| minute: int, | ||
| second: int = None, | ||
| tick: int = None, | ||
| err_msg: str = None, |
| diag axis init z | ||
| """ | ||
|
|
||
| z = np.empty(shape=NZ, dtype=np.float64, order="C") |
| field=var3, | ||
| ) | ||
|
|
||
| for itime in range(24): |
There was a problem hiding this comment.
this was overlooked in cFMS, ntime=24 should be defined and the loop should become for itime in range(ntime)
|
|
||
| ij = 0 | ||
| for i in range(NX): | ||
| for j in range(NY): |
There was a problem hiding this comment.
these loops are not needed, they can be var2 = - var2?
| diag_manager.diag_send_complete(diag_field_id=id_var2) | ||
|
|
||
| diag_manager.diag_end() | ||
|
|
There was a problem hiding this comment.
this was also overlooked in cFMS but the test should in the future have a check to read in the netcdf files and check values
| mpp.set_current_pelist(coarse_pelist) | ||
| name = "test coarse domain" | ||
| maskmap = np.full(shape=(2, 4), fill_value=True, dtype=np.bool_, order="C") | ||
| maskmap = np.full(shape=8, fill_value=True, order="C") |
There was a problem hiding this comment.
was this change needed? cFMS should work with multidimensional numpy arrays
| from .py_diag_manager.pyfms_diag_manager import pyFMS_diag_manager | ||
| from .py_field_manager.py_field_manager import FieldTable | ||
| from .py_horiz_interp.py_horiz_interp import HorizInterp | ||
| from .py_horiz_interp.py_horiz_interp import pyFMS_horiz_interp |
There was a problem hiding this comment.
let's change it back, the other modules need to be changed
|
|
||
| class DiagManager: | ||
|
|
||
| DIAG_ALL = 2 |
There was a problem hiding this comment.
this should be retrieved from cfms
There was a problem hiding this comment.
I have raised an issue for future handling of this; Issue 28
| multiple_send_data: bool = None, | ||
| ) -> int: | ||
|
|
||
| module_name = module_name[:64] |
There was a problem hiding this comment.
This would also need to be amended post closing of Issue 28
| realm_c, realm_t = set_Cchar(realm) | ||
| multiple_send_data_c, multiple_send_data_t = setscalar_Cbool(multiple_send_data) | ||
|
|
||
| if range.dtype == np.int32: |
There was a problem hiding this comment.
range is an optional argument, might not be the best argument to check for types
| NZ = 2 | ||
|
|
||
| domain_id = 0 | ||
| calendar_type = 4 |
There was a problem hiding this comment.
calendar related parameters should be imported from cfms
| x = np.arange(NX, dtype=np.float64) | ||
|
|
||
| for i in range(NX): | ||
| x[i] = i |
There was a problem hiding this comment.
np.arange handles this. this for loop is not needed.
| y = np.arange(NY, dtype=np.float64) | ||
|
|
||
| for j in range(NY): | ||
| y[j] = j |
There was a problem hiding this comment.
likewise, this for loop is not needed
|
|
||
| z = np.arange(NZ, dtype=np.float64) | ||
|
|
||
| for k in range(NZ): |
| register diag field var3 | ||
| """ | ||
|
|
||
| axes_3d = np.array([id_x, id_y, id_z, 0, 0], dtype=np.int32) |
There was a problem hiding this comment.
axes array in cfms was declared to have 5 elements t avoid having 2d-5d flavors of the same subroutine. There is no need for this to be true in python. Users should be able to use axes_3d = [id_x, id_y, id_z] and the conversion to have five elements be handled inside the python function
| for i in range(NX): | ||
| for j in range(NY): | ||
| for k in range(NZ): | ||
| var3[ijk] = -1.0 * var3[ijk] |
There was a problem hiding this comment.
is there a short hand notation to replace this expanded set of for loops? This explicitness is required in C but not in python?
| var3 = np.empty(shape=NX * NY * NZ, dtype=np.float32) | ||
|
|
||
| ijk = 0 | ||
| for i in range(NX): |
There was a problem hiding this comment.
from python, the variables can be declared as multidimensional
Feature: diag_manager
Description
This PR brings in the currently available diag_manager modules in cFMS and removes the use of
set_multipointer.How Has This Been Tested?
Current CI is awaiting update to container.
Checklist: